package mi.payment.settings;


import android.content.Context;
import android.content.SharedPreferences;

import mi.payment.MyApplication;
import mi.payment.utils.SharedPreferencesUtil;
import sunmi.sunmiui.utils.LogUtil;

public class SignOperation {

    private static final String LAST_SIGN_TIME = "LAST_SIGN_TIME";

    private static SignOperation instance;

    public static SignOperation getInstance() {
        if (instance == null) {
            instance = new SignOperation();
        }
        return instance;
    }

    public void saveLastSignTime(int time) {
        SharedPreferences spf = MyApplication.getInstance().getSharedPreferences(SharedPreferencesUtil.PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor edit = spf.edit();
        edit.putInt(LAST_SIGN_TIME, time);
        edit.apply();
    }

    public int getLastSignTime() {
        SharedPreferences spf = MyApplication.getInstance().getSharedPreferences(SharedPreferencesUtil.PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
        int anInt = spf.getInt(LAST_SIGN_TIME, 0);
        LogUtil.i("nsz", "LastSignTime:" + anInt);
        return anInt;
    }

}
